package com.twu.biblioteca.model;

public class Book extends LibraryItem {

    private final String author;

    public Book(String title, String author, String yearPublished) {
        super(title, yearPublished);
        this.author = author;
    }

    public String getAuthor() {
        return author;
    }

    @Override
    public String toString() {
        return "Title: '" + this.getTitle() + "'" + Book.LIST_SEPARATOR +
                "Author: '" + this.author + "'" + Book.LIST_SEPARATOR +
                "Published: '" + this.getYearPublished() + "'";
    }


    @Override
    public boolean hasDetails(String... args){
        if(args == null) return false;
        if(!(args.length == 3)) return false;
        if(!args[0].equalsIgnoreCase(getTitle())) return false;
        if(!args[1].equalsIgnoreCase(getAuthor())) return false;
        if(!args[2].equalsIgnoreCase(getYearPublished())) return false;
        return true;
    }
}
